package com.matongxue.springboot;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component  //ioc
@Data
public class User {

    @Value("zhangsan")
    private String name;
    @Value("10")
    private int age;

    //@Resource(name="car1")
    @Autowired(required = false) //di by class
    private Car car;
}
